package com.gxa.hystrix.service;

import com.gxa.hystrix.interfaces.GuaHaoByCheck;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author thinknovo
 * @version 1.0
 * @description guahaoservice.java
 * @date 2021/3/25 15:45
 */
@Service
public class GuaHaoService {
    @Resource
    private GuaHaoByCheck guahaobycheck;


    @HystrixCommand(fallbackMethod = "chaXunChuFangMoBanError")
    public Map chaXunChuFangMoBan(String jiuZhenShiJian) {
        return guahaobycheck.chaXunChuFangMoBan(jiuZhenShiJian);
    }

    public Map chaXunChuFangMoBanError(String jiuZhenShiJian) {
        Map map = new HashMap();
        map.put("code", 500);
        map.put("msg", "服务异常，请稍后重试！");
        return map;

    }

    @HystrixCommand(fallbackMethod = "chaXunQuanBuError")
    public Map chaXunQuanBu(String jiuZhenShiJianQiShi,
                            String jiuZhenShiJianJieShu,
                            String jiuZhenJiLuZhuangTai,
                            String guaDanDanHao,
                            String xingMing) {
        return guahaobycheck.chaXunQuanBu(jiuZhenShiJianQiShi,jiuZhenShiJianJieShu,jiuZhenJiLuZhuangTai,guaDanDanHao,xingMing);
    }

    public Map chaXunQuanBuError(String jiuZhenShiJianQiShi,
                                 String jiuZhenShiJianJieShu,
                                 String jiuZhenJiLuZhuangTai,
                                 String guaDanDanHao,
                                 String xingMing) {
        Map map = new HashMap();
        map.put("code", 500);
        map.put("msg", "服务异常，请稍后重试！");
        return map;

    }

    @HystrixCommand(fallbackMethod = "chaXunHuanZeError")
    public Map chaXunHuanZe(String guaHaoDanHao) {
        return guahaobycheck.chaXunHuanZe(guaHaoDanHao);
    }

    public Map chaXunHuanZeError(String guaHaoDanHao) {
        Map map = new HashMap();
        map.put("code", 500);
        map.put("msg", "服务异常，请稍后重试！");
        return map;

    }
}
